package com.sichen.member.service.impl;

import com.sichen.common.utils.R;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sichen.common.utils.PageUtils;
import com.sichen.common.utils.Query;

import com.sichen.member.dao.MemberLevelDao;
import com.sichen.member.entity.MemberLevelEntity;
import com.sichen.member.service.MemberLevelService;

import javax.annotation.Resource;


@Service("memberLevelService")
public class MemberLevelServiceImpl extends ServiceImpl<MemberLevelDao, MemberLevelEntity> implements MemberLevelService {

    @Resource
    MemberLevelDao memberLevelDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MemberLevelEntity> page = this.page(
                new Query<MemberLevelEntity>().getPage(params),
                new QueryWrapper<>()
        );
        return new PageUtils(page);
    }

    /**
     * 新增会员信息
     * @param memberLevel 前端输入的会员的信息
     * @return 返回添加是否成功
     */
    @Override
    public R insertOne(MemberLevelEntity memberLevel) {
        memberLevelDao.insertOne(memberLevel);
        return R.ok();
    }

}